//
//  MyTwoCollectionViewCell.m
//  ZhiHuiLiJiang
//
//  Created by work on 2018/11/13.
//  Copyright © 2018年 王雅鹏. All rights reserved.
//首页大模块菜单的cell

#import "MyTwoCollectionViewCell.h"
#import "BYHomeMajorMenuModel.h"//首页大模块菜单的model

@interface MyTwoCollectionViewCell()
/**图片*/
@property (strong, nonatomic) UIImageView *topImage;
/**文字*/
@property (strong, nonatomic) UILabel *botlabel;

@end
@implementation MyTwoCollectionViewCell
- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self){
        [self.contentView addSubview:self.topImage];
        [self.contentView addSubview:self.botlabel];
        [self.topImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView.mas_right);
            make.bottom.equalTo(self.contentView.mas_bottom);
            make.height.width.equalTo(self.contentView);
        }];
        [self.botlabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(BY_Width(28));
            make.top.equalTo(self.contentView.mas_top).offset(BY_Height(24));
        }];
    }
    return self;
}
- (UIImageView *)topImage{
    if (!_topImage) {
        _topImage = [[UIImageView alloc]init];
//        _topImage.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _topImage;
}
-(UILabel *)botlabel{
    if (!_botlabel) {
        _botlabel = [[UILabel alloc]init];
        _botlabel.font = BYPTFont36;
        _botlabel.textColor = [UIColor whiteColor];
        [_botlabel sizeToFit];
    }
    return _botlabel;
}

- (void)setMajorMenuModel:(BYHomeMajorMenuModel *)majorMenuModel{
    _majorMenuModel = majorMenuModel;
    self.botlabel.text = _majorMenuModel.name;//@"智慧党建";
    [self.topImage sd_setImageWithURL:[NSURL URLWithString:_majorMenuModel.img] placeholderImage:[UIImage imageNamed:@""]]; //[UIImage imageNamed:@"homeMenu_building"];

    
    
}


@end
